<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>Quick Test</title>
    <script type="text/javascript" src="../js/inputex-loader.js"></script>
    <script type="text/javascript" src="../lib/tabifier/tabifier.js"></script>
</head>
<body class="yui-skin-sam">
<!--<form id="testForm">-->
    <div id="test"></div>
    <!--<input type="submit"/>-->
<!--</form>-->
<textarea id="result" rows="30" cols="120"></textarea>

<script type="text/javascript">
    var field;
    inputEx.YUI({base:'../lib/yui3/',inputExBase:'../'}).use('stringfield', 'json', 'selectfield', function(Y) { // 'json' is required for the stringify on this method
        try {
            //Y.get('#test').set('innerHTML', 'loaded'); //require 'node'
            //            var global = new Y.inputEx.Global()

            //field = new Y.inputEx.Field({id:'testid'})

            field = new Y.inputEx.StringField({
                id:'myfield',
                name:'hello',  boundingBoxClass:'inputEx-fieldWrapper', showMsg:true,
                validator:[
                    {type:'meta',message:'there is at least one error in this field'},
                    {required:true,message:'this is a required field'},
                    {minLength:5,maxLength:10,message:'input length must be between {minLength} and {maxLength} characters'}
                ],
                label:'this is a test field',
                typeInvite: 'default', size: 30,
                description:'this field is for demonstration purpose only'});
            /*field = new Y.inputEx.SelectField({name: 'country',
             selectValues: ['US', 'FR'],
             selectOptions:['United States of America','France'],
             size:1,
             value:'US',
             label:'Please choose a country: ',
             showMsg:true});   */
            field.on('field:change', function(){Y.log('field change','info', 'dev')})
            field.on('field:focus', function(){Y.log('field focused','info', 'dev')})
            field.render('#test');
            /*field.on('updated', function(evt, newVal, oldVal) {
             alert('field is updated from ' + o + ' to ' + Y.JSON.stringify(evt))
             });*/
            //field.set('value', 'new value')
            //alert('el: ' + field.get('el'))
            //Y.get('#test').set('innerHTML', 'parentEl: ' + field.get('parentEl')); //require 'node'
            /*if (field.get('parentEl')){
             field.get('parentEl').set('innerHTML', 'found, el: ' + field.get('el'))
             }*/
            //Y.get('body').appendChild(field.get('el'))
            var testHTML = Y.Node.get('#test').get('innerHTML')
            Y.Node.get('#result').set('innerHTML', Y.inputEx.escapeHTML(testHTML))
            field.set('label', 'this is a new label')
            field.set('description', 'this is a new description')

            runTabifier('result', 'result', 'HTML')

            /*Y.get('#testForm').on('submit', function() {
                alert(field.get('value'));
                return false;
            }
                    )*/
        } catch(e) {
            Y.log(e, 'error', 'inputEx');
        }
    });
</script>
<div style="position:absolute; right:0; top:0; margin:10px">
    <a href="javascript:(function(){field.disable()})()">disable</a> |
    <a href="javascript:(function(){field.enable()})()">enable</a> |
    <a href="javascript:(function(){field.set('value', 'FR')})()">set('value', 'FR')</a> |
    <a href="javascript:alert(field.get('value'));">field.value</a> | 
    <a href="javascript:alert(field.get('inputEl').get('value'));">inputEl.value</a>
</div>
<!--
<p><a href="javascript:
    var w=window.d=document,l=d.location;
    if (typeof(YAHOO)=='undefined'){
        var head=d.getElementsByTagName('head')[0];
        var _l=d.createElement('link');_l.ref='stylesheet';_l.type='text/css';_l.href='http://yui.yahooapis.com/combo?2.6.0/build/logger/assets/skins/sam/logger.css';head.appendChild(_l);
        var _s=d.createElement('script');_s.src='http://yui.yahooapis.com/combo?2.6.0/build/yahoo-dom-event/yahoo-dom-event.js&2.6.0/build/dragdrop/dragdrop-min.js&2.6.0/build/logger/logger-min.js';head.appendChild(_s);
    }
    var main=function(){
new YAHOO.widget.LogReader();
    };
    var st = function() {if (typeof(YAHOO) === 'undefined') {setTimeout(st, 1000)} else {main()}};st();
    ">dev</a></p>-->

</body>
</html>